package com.liushuai.eas.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.liushuai.eas.mapper.DepartmentMapper;
import com.liushuai.eas.mapper.MajorMapper;
import com.liushuai.eas.pojo.Department;
import com.liushuai.eas.pojo.Major;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

@Service
public class MajorImp implements MajorMapper {

    @Resource
    private MajorMapper majorMapper;

    @Resource
    private DepartmentMapper departmentMapper;

    @Override
    public int insert(Major entity) {
        return majorMapper.insert(entity);
    }

    @Override
    public int deleteById(Serializable id) {
        return majorMapper.deleteById(id);
    }

    @Override
    public int deleteById(Major entity) {
        return majorMapper.deleteById(entity);
    }

    @Override
    public int deleteByMap(Map<String, Object> columnMap) {
        return 0;
    }

    @Override
    public int delete(Wrapper<Major> queryWrapper) {
        return 0;
    }

    @Override
    public int deleteBatchIds(Collection<?> idList) {
        return 0;
    }

    @Override
    public int updateById(Major entity) {
        return majorMapper.updateById(entity);
    }

    @Override
    public int update(Major entity, Wrapper<Major> updateWrapper) {
        return 0;
    }

    @Override
    public Major selectById(Serializable id) {
        return majorMapper.selectById(id);
    }

    @Override
    public List<Major> selectBatchIds(Collection<? extends Serializable> idList) {
        return null;
    }

    @Override
    public List<Major> selectByMap(Map<String, Object> columnMap) {
        return null;
    }

    @Override
    public Major selectOne(Wrapper<Major> queryWrapper) {
        return majorMapper.selectOne(queryWrapper);
    }

    @Override
    public Long selectCount(Wrapper<Major> queryWrapper) {
        return null;
    }

    @Override
    public List<Major> selectList(Wrapper<Major> queryWrapper) {
        return null;
    }

    @Override
    public List<Map<String, Object>> selectMaps(Wrapper<Major> queryWrapper) {
        return null;
    }

    @Override
    public List<Object> selectObjs(Wrapper<Major> queryWrapper) {
        return null;
    }

    @Override
    public <P extends IPage<Major>> P selectPage(P page, Wrapper<Major> queryWrapper) {
        return majorMapper.selectPage(page, queryWrapper);
    }

    @Override
    public <P extends IPage<Map<String, Object>>> P selectMapsPage(P page, Wrapper<Major> queryWrapper) {
        return null;
    }

    @Override
    public List<Major> queryMajorList(int pageBegin, int pageEnd) {
        return majorMapper.queryMajorList(pageBegin,pageEnd);
    }

    @Override
    public List<Major> queryMajorListBySearch(int pageBegin, int pageEnd, String search) {
        return majorMapper.queryMajorListBySearch(pageBegin,pageEnd,search);
    }

    @Override
    public int queryTotal() {
        return majorMapper.queryTotal();
    }

    @Override
    public int queryTotalBySearch(String search) {
        return majorMapper.queryTotalBySearch(search);
    }

    @Override
    public Major selectOne(Integer id) {
        Major major = majorMapper.selectOne(id);
        major.setDepartment(departmentMapper.selectOne(major.getDepartmentId()));
        return major;
    }

    @Override
    public List<Major> queryMajorListAll() {
        return majorMapper.queryMajorListAll();
    }
}
